<template>
  <div class="item-size-choose" @touchmove.stop.prevent>
    <div
      :class="{
        mask: true,
        animated: true,
        fadeIn: !pageLeave,
        fadeOut: pageLeave
      }"
      @click="maskClick"
    ></div>
    <div
      :class="{
        'choose-panel': true,
        animated: true,
        slideInUp: !pageLeave,
        slideOutDown: pageLeave
      }"
      @click.stop
    >
      <div class="top-bar">
        <div class="title">立即分享</div>
        <div @click="maskClick" class="btn-close">×</div>
      </div>
      <div class="share-bar">
        <div @click="maskClick();$emit('wxShare', 1)" class="share-btn">
          <img src="@/assets/动态更多交互-assets/weixin.png" alt="" />
          <div>微信好友</div>
        </div>
        <!-- <div @click="maskClick();$emit('wxShare', 2)" class="share-btn">
          <img src="@/assets/动态更多交互-assets/penyouquan.png" alt="" />
          <div>微信朋友圈</div>
        </div> -->
        <div @click="qrCode" class="share-btn">
          <img src="@/assets/动态更多交互-assets/ewm.png" alt="" />
          <div>商品二维码</div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import { mapState } from 'vuex'
export default {
  data() {
    return {
      pageLeave: false
    };
  },
  computed: {
    ...mapState({
      isMiniProgram: state => state.app.isMiniProgram
    })
  },
  methods: {
    maskClick() {
      this.pageLeave = true;
      setTimeout(() => {
        this.$emit("panelClose", "");
      }, 400);
    },
    qrCode() {
      // this.maskClick()
        this.$emit("qrCode");
      
    }
  },
  mounted() {}
};
</script>

<style lang="less" scoped>
.item-size-choose {
  z-index: 9999;
  position: relative;

  .mask {
    animation-duration: 0.4s;
    position: fixed;
    left: 0;
    top: 0;
    z-index: 9999;
    height: 100%;
    width: 100%;
    background-color: rgba(0, 0, 0, 0.6);
  }

  .choose-panel {
    animation-duration: 0.4s;
    z-index: 10000;
    position: fixed;
    left: 0;
    bottom: 0;
    width: 100%;
    height: 10rem;
    background: rgba(245, 245, 245, 1);
    border-top-left-radius: 0.4rem;
    border-top-right-radius: 0.4rem;

    .share-bar {
      display: flex;
      width: 100%;
      justify-content: space-around;
      padding: 0 3.2%;
      margin-top: 2rem;
      text-align: center;
      color: rgba(68, 68, 68, 1);
      font-size: 0.56rem;
      height: 3.5rem;

      .share-btn {
        width: 25%;

        img {
          width: 2rem;
          height: 2rem;
        }
      }
    }

    .bottom-bar {
      margin-top: 1rem;
      justify-content: flex-start;
    }

    .text {
      border-right: 1px solid #dfdfdf;
    }

    .top-bar {
      // position: fixed;
      padding: 0 3.2%;
      width: 100%;
      left: 0;
      bottom: 10rem;
      text-align: center;
      margin-top: 0.6rem;

      .title {
        font-weight: bold;
        color: rgba(68, 68, 68, 1);
        font-size: 0.64rem;
      }

      .btn-close {
        position: absolute;
        right: 0.54rem;
        top: 0.3rem;
        font-size: 1rem;
      }
    }
  }
}
</style>
